import static java.lang.System.out;
import java.util.Scanner;
/**
 * Created by zyl on 2017/6/8.
 */

public class MessageDAODemo {
    public static void main(String[] args) throws Exception {
        MessageDAO dao = new MessageDAO(
                "jdbc:mysql://localhost:3306/world?" +
                        "useUnicode=true&characterEncoding=UTF8",
                "root", "");
        Scanner console = new Scanner(System.in, "Big5");
        while(true) {
            dao.get().forEach(message -> {
                out.printf("%s\t%d%n",
                        message.getName(),
                        message.getPopulation());
            });
        }
    }

}